import requests
import hashlib
import time

appKey = '12574478'
time1 = int(time.time()*1000)

cookies = {
    "thw": "cn",
    "miid": "6166233722528632848",
    "tracknick": "tb_7484407",
    "sgcookie": "E100v2sJsmBlQrfhjee9IBvC%2F1ySH60N0vc1kfSoz3h6xVmXGg4BFWoPBHkivvgi26rbJ4SMiYnvxfDQIA%2B%2F02MUF%2F%2Bwf80k11IfeFEdoHV4RRxdDnjcMJvO2o7ucoiAsvoC",
    "havana_lgc2_0": "eyJoaWQiOjcwMzMyNDczMiwic2ciOiIzZjk1ZDNjYTRiOWZkMDllZjBkYzZmNjE0NGNhZDZkNCIsInNpdGUiOjAsInRva2VuIjoiMXFacmc3WjJKUjNENGNUXzRkdHFjR3cifQ",
    "_hvn_lgc_": "0",
    "havana_lgc_exp": "1760773486688",
    "wk_cookie2": "1045bb40bab30283de875612dce5f4f0",
    "wk_unb": "VAFcvlnKLQ%2BS",
    "_cc_": "VFC%2FuZ9ajQ%3D%3D",
    "cna": "q5WcHw/EVFsCAWonZx76Ry1B",
    "t": "232ddffe85360f7582dbaf069692f249",
    "3PcFlag": "1733810358180",
    "_tb_token_": "38ebb1ed883e4",
    "mtop_partitioned_detect": "1",
    "xlly_s": "1",
    "_samesite_flag_": "true",
    "sdkSilent": "1734157249531",
    "cookie2": "130e8ac20c0fecc441f520d8eb1c0148",
    "havana_sdkSilent": "1734157249531",
    "_m_h5_tk": "5d33a642b850a5ef8636b0b5f12efa09_1734084978028",
    "_m_h5_tk_enc": "f4f7c65100147fb7379227cbc2a36da5",
    "uc1": "cookie14=UoYdWTlkF5m5Zg%3D%3D",
    "isg": "BLu7T7O8WJlLemRvbfDAnuTBSp8lEM8Srzgroq146rrCDNruNeInYugFJqxCLCcK",
    "tfstk": "gE8rDo49x43yffLrKsbUuxxhURQR5aD_qe6CtBAhNTXuAYL2tp9PVbKWt6benpGRFBDJLeWD6Tw5rwTe3dpwAbCWd6v29pBu-DUHikJCrMK5dT6F8BpZGAgs5QdRJaDsCVgPbltAW_Xhq_cno17FZh6ocHdRJwDbGyms7QpM21gkEwcVo65LEwf3qZcVT62l-Tj3nofGn9bHKTAcn61_xuXhEqcV9tXh-zXogID9rQA3u1so6PQTvGVeOgWMZtzwMEfovOgOnyf6o_jy-16VciTVagWGDCsIQUvXtUTRDmEfJItwLHvihu6kb1JVf3kazdJRtK7WSXnRDMYe8sKxLkWwxQt9xilorI7PUi5P47rhzHvJ8gKz9fdcrKKOBgmxHs8W5MWO0-DkGIWlbHJSHyXWbIvVfEwb5Nx93eSGSg5TpsYR0eKzKkSlMsWsgj8zMvxJ_r8FzkEdmNCVCb17vkIlMsWsgjrLvifOgOG5N"
}

headers = {
    'accept': 'application/json',
    'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8',
    'cache-control': 'no-cache',
    'content-type': 'application/x-www-form-urlencoded',
    # 'cookie': 'thw=cn; miid=6166233722528632848; tracknick=tb_7484407; sgcookie=E100v2sJsmBlQrfhjee9IBvC%2F1ySH60N0vc1kfSoz3h6xVmXGg4BFWoPBHkivvgi26rbJ4SMiYnvxfDQIA%2B%2F02MUF%2F%2Bwf80k11IfeFEdoHV4RRxdDnjcMJvO2o7ucoiAsvoC; havana_lgc2_0=eyJoaWQiOjcwMzMyNDczMiwic2ciOiIzZjk1ZDNjYTRiOWZkMDllZjBkYzZmNjE0NGNhZDZkNCIsInNpdGUiOjAsInRva2VuIjoiMXFacmc3WjJKUjNENGNUXzRkdHFjR3cifQ; _hvn_lgc_=0; havana_lgc_exp=1760773486688; wk_cookie2=1045bb40bab30283de875612dce5f4f0; wk_unb=VAFcvlnKLQ%2BS; _cc_=VFC%2FuZ9ajQ%3D%3D; cna=q5WcHw/EVFsCAWonZx76Ry1B; t=232ddffe85360f7582dbaf069692f249; 3PcFlag=1733810358180; _tb_token_=38ebb1ed883e4; mtop_partitioned_detect=1; xlly_s=1; _samesite_flag_=true; sdkSilent=1734157249531; cookie2=130e8ac20c0fecc441f520d8eb1c0148; havana_sdkSilent=1734157249531; uc1=cookie14=UoYdWTlkH30UjQ%3D%3D; isg=BAcHa-pdLMX3qagLOXxUMoiFlrvRDNvuU_znBtn1sBY3SCYK4d4hPndB6ggWoLNm; _m_h5_tk=2ff7e29a2f791eebf4eb0e7bff42e067_1734078890342; _m_h5_tk_enc=d90d20e5bf017411419c43cf066bf20b; tfstk=g3Om0l_ByKWXfEKLD35jQ4IPgak8hr11-hFOX1IZUgS7WILV61cM2hYAQGHXjOx9VORAMEKub38C0GLAgNVMxh2A6GC27GjP8VZN_V1glQx36SnjhFPG61oKvXhplr11_DQyRbq0lNQNu5rO3alP6NvLgYLHlE1_PzEZpL8bjKy9F15wb_WP7w1aQ-WqrT7O71PVQSyz4g_N_1S43TyPWNeNuNPZrUS5S17V_1ukzAn3_MAwNQoxAj9s3p6vZZXcYUDQs5yVlkIHuqPT1QvkrModq5PwZZYJPmHYtAIediBdA3l8i1YPS3XpnDVDjF8BQTAg0qKe7nOlG6Dtl9vyepBDEmPG2IQGL1Wu758l_KWws6lUqa9ykdRXmPVNlIddIM6o756OaBBeLn4sRU5V7h6B6DNf0F8BOpCnik_DUefl4MwzL3CU1au9aRw13a_lv-NCh29aL5x-r42Iht75kD3orRw13a_lv40udo6VPZnd.',
    'origin': 'https://zc-paimai.taobao.com',
    'pragma': 'no-cache',
    'priority': 'u=1, i',
    'referer': 'https://zc-paimai.taobao.com/',
    'sec-ch-ua': '"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-site',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
}

params = {
    'jsv': '2.6.1',
    'appKey': '12574478',
    # 't': '1734070981193',
    # 'sign': 'a663bc506fe5a8eb3d60655209d237af',
    'bxPageId': '1410667',
    'api': 'mtop.taobao.datafront.invoke.auctionwalle',
    'v': '1.0',
    'type': 'originaljson',
    'dataType': 'json',
    'requiredParams': 'dfApiName,dfUniqueId',
}



data = {
    'data': '{"dfApp":"auctionwalle","dfApiName":"auctionwalle.datou.getPageModulesData","dfVariables":"{\\"pageId\\":1410667,\\"moduleIds\\":\\"9018433170:items\\",\\"context\\":{\\"_b_9018433170:items\\":\\"{\\\\\\"spm\\\\\\":\\\\\\"a2129.27064540.puimod-zc-focus-2021_2860107850.category-1-1\\\\\\",\\\\\\"pmid\\\\\\":\\\\\\"3010350770_1734070967601\\\\\\",\\\\\\"pmtk\\\\\\":\\\\\\"20140647.0.0.0.27064540.puimod-zc-focus-2021_2860107850.category-1-1\\\\\\",\\\\\\"path\\\\\\":\\\\\\"27064540\\\\\\",\\\\\\"userInfo\\\\\\":{},\\\\\\"page\\\\\\":\\\\\\"1\\\\\\",\\\\\\"appendMap\\\\\\":{\\\\\\"sid\\\\\\":\\\\\\"6320193436_1734070971666\\\\\\"}}\\",\\"userInfo\\":\\"{}\\",\\"device\\":\\"pc\\",\\"sceneCode\\":\\"20200713C5R32B6N\\"}}","dfUniqueId":"1410667.9018433170:items","dfVariablesRecover":"{}"}',
}

p = '5d33a642b850a5ef8636b0b5f12efa09' + "&" + str(time1) + "&" + appKey + "&" + data['data']

print(p)
sign = hashlib.md5(p.encode()).hexdigest()
params['sign'] = sign
params['t'] = str(time1)

print(params)

response = requests.post(
    'https://h5api.m.taobao.com/h5/mtop.taobao.datafront.invoke.auctionwalle/1.0/',
    params=params,
    cookies=cookies,
    headers=headers,
    data=data,
)
print(response.json())